<?

$mid = 3;
require("required/dbconnect.php");
require_once("required/function.php");



$title = "Import Data";
require("required/header.php");
$id = $_GET['id'];

$get_info = mysql_query("select * from os_shipping_company where id='$id'");
$a = mysql_fetch_array($get_info, MYSQL_ASSOC);
?>

<script src="required/js/jquery-1.4.2.js" type="text/javascript"></script>
<script src="required/js/blockui.js" type="text/javascript"></script>
<script src="required/js/common_javascript.js"></script>
<script >
    function submitFrm()
    {
        $.blockUI({ message: '<h1><img src="images/loading.gif" />Uploading, Just a moment...</h1>' });
        document.frm1.submit();
    }
        
    function frmValidate(frm1)
    {
        if(document.getElementById("group_name").value=="")
        {
            alert("Please enter group name");
            return false;
        }
        return true;
    }
</script>
<?
if (empty($_GET['dispmsg'])) {
    $msg = "";
} else {
    if($_GET['dispmsg']=="no_file_selected")
    {
        $msg = "<div class='dw_failed'>Please select a file to upload</div>";
    }else{
        $msg = "<div class='dw_failed'>Invalid file format, only .csv is allowed</div>";
    }
    echo "<script>displayMsg('divMsg')</script>";
}
?>
<table width="100%" cellpadding="0" cellspacing="0" height="100%">

    <td valign="top" align="left">
        <table width="95%" align="center">
            <tr>
                <td class="title"><?= $title ?></td>
            </tr>
            <tr>
                <Td><div id="divMsg"><?= $msg ?></div></td>
            </tr>

            <tr>
                <td>
                    <form enctype="multipart/form-data" action="shipping_import2.php" method="POST" name="frm1" onsubmit="return frmValidate(this)">                

                        <table  width="100%">
                            <tr>
                                <td>Courier Name</td>
                                <td>: <?= $a['company_name'] ?></td>
                            </tr>
                            <tr>
                                <td width="11%">File</td>
                                <td width="89%">: 
                                    <input name="file" type="file" />  File size MUST less than 2MB
                                    <br>

                                </td>
                            </tr>

                            <tr>
                                <Td>Group Name</Td><Td>: <input type="text" size="20" maxlength="100" name="group_name" id="group_name" /></Td>

                            </tr>
                            <tr>
                                <td colspan="2">
                                    <input type="hidden" name="MAX_FILE_SIZE" value="2000000" class="text" />
                                    <input type="hidden" name="courier_id" value="<?= $id ?>" >
                                    <input type="button" value="Upload File" class="text" onclick="submitFrm()" /> 
                                    <input type="button" value="Back" class="text" onclick="window.open('shipping_view_full.php?id=<?= $id ?>','_self')" /> 
                                        

                                </td>
                            </tr>
                        </table>
                    </form>


                </td>
            </tr>
        </table>

    </td>
</table>					
<?
require("required/footer.php");
?>               
